import request from '../utils/request'

export async function queryUsers() {
  return request('/api/users')
}

export async function fetch({ page = 1 }) {
  return request(`/api/users?_page=${page}&_limit=5`)
}

export async function create(values) {
  return request('/api/users',{
    methods: 'POST',
    data: JSON.stringify(values)
  })
}

export async function patch({ id, values }) {
  return request(`/api/users/${id}`,{
    methods: 'PATCH',
    data: JSON.stringify(values)
  })
}

export async function remove( {id } ) {
  return request(`/api/users/${id}`,{
    methods: 'DELETE'
  })
}
